<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ApplicationController</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ApplicationController</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/app/controllers/application_rb.html">
                app/controllers/application.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                ActionController::Base
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Filters added to this controller apply to all controllers in the
application. Likewise, all the methods added will be available for all
controllers.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000109">ensure_adm</a>&nbsp;&nbsp;
      <a href="#M000107">ensure_login</a>&nbsp;&nbsp;
      <a href="#M000112">get_mod</a>&nbsp;&nbsp;
      <a href="#M000110">get_mod_cuenta</a>&nbsp;&nbsp;
      <a href="#M000111">get_mod_cv</a>&nbsp;&nbsp;
      <a href="#M000108">login_home</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="AuthenticatedSystem.html">AuthenticatedSystem</a></span>
      </div>
    </div>

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000109" class="method-detail">
        <a name="M000109"></a>

        <div class="method-heading">
          <a href="#M000109" class="method-signature">
          <span class="method-name">ensure_adm</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000109-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000109-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/application.rb, line 32</span>
32:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ensure_adm</span>
33:                 <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">current_user</span>
34:                         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">role_user</span>.<span class="ruby-identifier">descripcion</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'Administrador'</span> <span class="ruby-keyword kw">then</span>
35:                                 <span class="ruby-identifier">flash_warning</span> <span class="ruby-identifier">:message</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;No posee los permisos suficientes.&quot;</span>
36:                                 <span class="ruby-identifier">redirect_to</span>(<span class="ruby-value str">'/login'</span>)
37:                         <span class="ruby-keyword kw">end</span>
38:                 <span class="ruby-keyword kw">end</span>           
39:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000107" class="method-detail">
        <a name="M000107"></a>

        <div class="method-heading">
          <a href="#M000107" class="method-signature">
          <span class="method-name">ensure_login</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
See ActionController::Base for details
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000107-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/application.rb, line 18</span>
18:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ensure_login</span>
19:                 <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">logged_in?</span>
20:                         <span class="ruby-identifier">flash_warning</span> <span class="ruby-identifier">:message</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;Debe loguearse antes de utilizar el sistema.&quot;</span>  
21:                         <span class="ruby-identifier">redirect_to</span>(<span class="ruby-value str">'/login'</span>)
22:                 <span class="ruby-keyword kw">end</span>
23:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000112" class="method-detail">
        <a name="M000112"></a>

        <div class="method-heading">
          <a href="#M000112" class="method-signature">
          <span class="method-name">get_mod</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000112-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/application.rb, line 59</span>
59:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_mod</span>
60:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">current_user</span>
61:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">role_user</span>.<span class="ruby-identifier">descripcion</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'Invitado'</span> <span class="ruby-keyword kw">then</span>
62:                                 <span class="ruby-identifier">redirect_to</span>(<span class="ruby-value str">'/login'</span>)
63:                         <span class="ruby-keyword kw">end</span>
64:                 <span class="ruby-keyword kw">end</span>   
65:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000110" class="method-detail">
        <a name="M000110"></a>

        <div class="method-heading">
          <a href="#M000110" class="method-signature">
          <span class="method-name">get_mod_cuenta</span><span class="method-args">(cuenta)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000110-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000110-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/application.rb, line 41</span>
41:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_mod_cuenta</span>(<span class="ruby-identifier">cuenta</span>)
42:                 <span class="ruby-ivar">@asignados</span> = <span class="ruby-constant">UsuarioCuenta</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:first</span>,<span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'user_id = ? and cuenta_id = ?'</span>, <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">cuenta</span>.<span class="ruby-identifier">id</span>])
43:                 <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@asignados</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">role_user</span>.<span class="ruby-identifier">descripcion</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'Administrador'</span> <span class="ruby-keyword kw">then</span>
44:                         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
45:                 <span class="ruby-keyword kw">else</span>
46:                         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>         
47:                 <span class="ruby-keyword kw">end</span>
48:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000111" class="method-detail">
        <a name="M000111"></a>

        <div class="method-heading">
          <a href="#M000111" class="method-signature">
          <span class="method-name">get_mod_cv</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000111-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000111-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/application.rb, line 51</span>
51:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_mod_cv</span>
52:                 <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">current_user</span>
53:                         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">role_user</span>.<span class="ruby-identifier">descripcion</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'Invitado'</span> <span class="ruby-keyword kw">then</span>
54:                                 <span class="ruby-identifier">redirect_to</span>(<span class="ruby-value str">'/login'</span>)
55:                         <span class="ruby-keyword kw">end</span>
56:                 <span class="ruby-keyword kw">end</span>           
57:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000108" class="method-detail">
        <a name="M000108"></a>

        <div class="method-heading">
          <a href="#M000108" class="method-signature">
          <span class="method-name">login_home</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000108-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000108-source">
<pre>
    <span class="ruby-comment cmt"># File app/controllers/application.rb, line 26</span>
26:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">login_home</span>
27:                 <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">logged_in?</span>
28:                         <span class="ruby-identifier">redirect_to</span>(<span class="ruby-identifier">welcome_user_path</span>(<span class="ruby-identifier">current_user</span>))
29:                 <span class="ruby-keyword kw">end</span>
30:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>